<template>
	<view class="content">
     <GoodsList></GoodsList>
	</view>
</template>

<script>
  import GoodsList from '../components/GoodsList.vue'
	export default {
    components: { GoodsList },
		data() {
			return {
        // 商品卡片列表
        goodsList: [],
        // 查询数据
        params: {
          // 分类
          categoryId: "",
          // 搜索关键字
          keywords: '',
          // 页码
          pageNum: 1,
          // 条数
          pageSize: 12,
          // 排序  排序字段：sortField: rate_price(价格)、share_commission(佣金)、month_sales(销量)
          sortField: '',
          // 排序方式：sortOrder: desc(降序) 、asc(升序)
          sortOrder: '',
        },
			}
		},
		mounted() {
      this.getData()
		},
		methods: {
      getData() {
        let params = {
          categoryId: this.params.categoryId,
          keyword: "",
          pageNum: this.params.pageNum,
          pageSize: this.params.pageSize,
          sortField: "",
          sortOrder: "",
        }
        uni.request({
          url: 'https://api.hdtun.com/api/goods/list',
          data: params,
          success: (res) => {
            console.log('res',res)
            this.goodsList = res.data.data.list
          }
        })
      }
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
